package com.itheima.mapper;

import com.itheima.pojo.*;
import org.apache.ibatis.annotations.*;

import java.awt.print.Book;
import java.util.List;

@Mapper
public interface BusinessMapper {
    @Select("select *from business where businessName=#{name} and password=#{password}")
    public User Blogin(User user);
    @Select("select *from emp")
    public List<Emp> showEmp();

    public List<Emp> conShowEmp(String name);

    @Select("select *from emp where empId=#{empId}")
    public Emp changeEmp1(Long empId);

    @Update("update emp set empName=#{empName},phone=#{phone} where empId=#{empId}")
    public void changeEmp2(Emp emp);

    @Update("update emp set state=#{state} where empId=#{empId}")
    public void changeState(String state,Long empId);

    @Insert("insert into emp(empName,phone,state,password) values (#{empName},#{phone},#{state},#{password})")
    public void addEmp(Emp emp);

    @Select("select *from foodcategory")
    public List<FoodCategory> showCategory();

    @Select("select *from food")
    public List<Food> showFood();

    @Select("select *from food where foodId=#{foodId}")
    public Food changeFood1(Long foodId);

    @Update("update food set foodName=#{foodName},price=#{price},category=#{category},imgine=#{imgine},foodState=#{foodState} where foodId=#{foodId}")
    public void changeFood2(Food food);

    public List<Food> conShowFood(Food food);

    @Delete("delete from food where foodId=#{foodId}")
    public void deleteFood(Long foodId);
    @Insert("insert into food (foodName,price,foodState,category,imgine) values (#{foodName},#{price},#{foodState},#{category},#{imgine})")
    public void addFood(Food food);
    @Update("update food set foodState=#{foodState} where foodId=#{foodId}")
    public void changeFoodState(Long foodId,String foodState);

    public int conCount(OrderForm form);
    public List<OrdersList> conPage(Long orderId,String orderState,String userName,int start,int pageSize);

    @Update("update orders set orderState='取消订单' where orderId=#{orderId}")
    public void cancelOrder(Long orderId);

    @Update("update orders set orderState='等待骑手' where orderId=#{orderId}")
    public void acceptOrder(Long orderId);

    @Select("select * from foodcategory where categoryId=#{categoryId}")
    public FoodCategory changeCategory1(Long categoryId);

    @Update("update foodcategory set category=#{category} where categoryId=#{categoryId}")
    public void changeCategory2(FoodCategory categoryForm);
    @Delete("delete from foodcategory where categoryId=#{categoryId}")
    public void deleteCategory(Long categoryId);
    @Insert("insert into foodcategory (category) values (#{category});")
    public void addCategory(String category);
}
